package exception;

import java.io.FileOutputStream;
import java.io.IOException;

/**
 * 异常处理机制在IO中的应用
 */
public class FinallyDemo2 {
    public static void main(String[] args) {

        FileOutputStream fos = null;
        try {
            fos = new FileOutputStream("./m/n/fos.dat");
            fos.write(1);
            System.out.println("tyr块正常结束了...");
        } catch (IOException e) {
            System.out.println("出错并处理了");
        } finally {
            try {
                if(fos != null){
                    fos.close();
                }
            } catch (IOException e) {
                System.out.println("finally中出错并处理了");
            }
        }







    }
}
